#ifndef QRULEGROUPMODEL_H
#define QRULEGROUPMODEL_H


#include <stdio.h>
#include <stdlib.h>
#include <QAbstractItemModel>
#include <QAbstractTableModel>

#include "org/rule.h"
#include "org/vars.h"

using namespace Org;

class QRuleGroupModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    vector<RuleGroup> *rule_groups;
    QRuleGroupModel(vector<RuleGroup>*, QObject *parent = 0);

    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
    QVariant data(const QModelIndex &index, int role) const;

    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
    bool setData(const QModelIndex &index, const QVariant &value, int role= Qt::EditRole);

    Qt::ItemFlags flags(const QModelIndex &index) const;

    // inserting and removing rows
    bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());
    bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());

};

#endif // QRULEGROUPMODEL_H
